fix(launch): skip script concatenation for projects with esm scripts#2145
Closed
kpal81xd wants to merge 1 commit into
Closed
fix(launch): skip script concatenation for projects with esm scripts#2145kpal81xd wants to merge 1 commit into
kpal81xd wants to merge 1 commit into
Conversation
Concatenation is a classic-scripts-only backend feature. Enabling it for a project that contains esm (.mjs) scripts makes the concatenated-scripts endpoint time out (504), so the engine preload blocks on the request and the launcher never finishes loading. Guard concatenateScripts=true at its only source so it is not requested when the project has any esm script.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
|
Closing: investigation of the backend (monorepo) shows the concatenation service already excludes ESM ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Launching with Concatenate Scripts (Classic) enabled (
concatenateScripts=true) hangs the launcher — it never finishes loading — for any project that contains ESM (.mjs) scripts.Script concatenation is a classic-scripts-only backend feature. When the project also has ESM scripts, the
/api/projects/:id/concatenated-scripts/scripts.jsendpoint times out:Every preloaded classic script points at that URL, so the engine's preload blocks on the failing request and the loading screen stalls until the gateway times out.
Fix
Guard
concatenateScripts=trueat its single source (launchAppinviewport-launch.ts): don't request concatenation when the project contains any ESM script. Evaluated fresh on each launch, so it tracks scripts added/removed mid-session, and the&&short-circuits so the asset scan only runs when the option is checked.Notes / trade-offs
?concatenateScripts=trueURL still bypasses this; the launcher can't reliably detect ESM before it routes assets. The real cure there is the backend not 504-ing.Testing
eslintclean on the changed file;typecheckintroduces no new errors (pre-existing baseline unchanged).